package com.lej.push

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.lej.push.provider.PushProviderImpl
import kotlinx.coroutines.launch

/**其他应用跳转中转页面以及推送承载页面*/
class DeeplinkActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        deeplink(intent)
    }

    override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)
        deeplink(intent)
    }

    private fun deeplink(intent: Intent?) {
        PushProviderImpl.cacheIntent = intent
        lifecycleScope.launch {
            PushProviderImpl.pushMap(this@DeeplinkActivity)
            finish()
        }
    }
}